<html>
<head>
	<meta charset='utf-8' />
	<title>便民信息</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<style>
		@media screen and (max-width:450px){
			#nav_bottom{width:98%;margin:0 auto}
			#content{width:98%;margin:0 auto}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
		@media screen and (min-width:450px){
			#nav_bottom{width:450px;margin:0 auto}
			#content{width:450px;margin:0 auto}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
	</style>
</head>
<body style='padding:0;margin:0;background:#eee'>
	<!--主内容区-->
	<div style='margin-bottom:80px' id='content'>
	
		<!--顶部广告区-->
		<div style='margin-bottom:5px;height:70px;border:1px solid'>
			顶部广告区
		</div>


		<div style='font:normal bold 18px/30px normal;text-align:center;color:#abc'>
			发布信息
		</div>
		

		<!--提交表单-->
		<form name='issue' id='service_issue' action='interface.php?type=issue_c' method='post' enctype="multipart/form-date">
			
			<!--获取服务列表-->
			<div id='service_issue_serviceList'></div>

			<!--获取服务下分类条件-->
			<div id='service_issue_serviceList_condition'></div>
			<input type='hidden' name='city1' />
			<input type='hidden' name='city2' />
			<input type='hidden' name='city3' />
			<div style='text-align:center;margin:30px 0'>
				<input type='submit' value='提交' />
				<input type='reset' value='提交' />
			</div>
		</form>
	</div>


</body>
</html>
<script src='./Public/Js/jquery.js'></script>
<script src='./Service/Js/functions.js'></script>
<script>

//验证登陆cookie
login_v();

$(function(){
	//初始化城市地区代码
	sessionStorage.city1 = 7;		
	sessionStorage.city2 = 91;
	sessionStorage.city3 = 912;

	//填充隐藏表单的城市信息
	$('input[name=city1]').val(sessionStorage.city1);
	$('input[name=city2]').val(sessionStorage.city2);
	$('input[name=city3]').val(sessionStorage.city3);


	//加载服务列表及相应表单项
			$.ajax({
				url:'interface.php',
				data:{
					type:'token',
				},
				success:function(token){
					$.ajax({
						url:'before.php/Before/Index/service_issue_serviceList',
						data:{
							token:token
						},
						success:function(res){
							$('#service_issue_serviceList').html(res);
							service_issue_getCondition();	//加载服务下分类条件及其它表单项
						}
					});
				}
			})
/*	$.ajax({
		url:'Service/Template/Service_issue/service_issue_serviceList.html',
		success:function(res){
			$('#service_issue_serviceList').html(res);
			service_issue_getCondition();	//加载服务下分类条件及其它表单项
		},
		error:function(){
		}
	})*/





	//加载底部导航
	$.ajax({
		url:'./Public/Base/before_base_bottom_nav.html',
		success:function(res){
			$(res).appendTo('body');
		}
	})

//----- Service/Template/img_record_stamp 页面记录每天的零点时间戳。用来分割删除今天以前的图片缓存

	//设置临时图片的保存时间分割点,过期则删除数据库中过期的临时图片，并更新时间戳
	var t = new Date();
	var y = t.getFullYear();
	var m = t.getMonth()+1;
	var d = t.getDate();
	var a1 = new Date(Date.parse(y+' '+m+' '+d+' 00:00:00')).getTime();
	$.ajax({
		url:'Service/Template/img_record_stamp',
		success:function(res){
			if(a1 > parseInt(res)){
				$.ajax({
					url:'interface.php',
					data:{
						type:'token',
					},
					success:function(token){
						$.ajax({
							url:'interface.php',
							data:{
								type:'img_record_update',
								stamp:a1,
								token:token
							},
							success:function(res3){
								//alert(res3);
							}
						});
					}
				});
			}else{
			//	alert(a1+"\r\n"+res+"\r\n"+new Date(parseInt(res)));
			}
		},
		error:function(){
			$.ajax({
				url:'interface.php',
				data:{
					type:'token'
				},
				success:function(res){
					$.ajax({
						url:'interface.php',
						data:{
							type:'img_record_stamp',
							token:res,
							stamp:a1
						},
						success:function(res2){
							//alert(res2);
						}
					});
				}
			});
		}

	});

});



//----- sessionStorage.service_info 存储服务名与相应id

//加载服务下分类条件及其它表单项
function service_issue_getCondition(){
	var services = new Array();
	services = sessionStorage.service_info.split(',');  
	switch(services[1]){
		case '二手物品':	
			var file_name = 'exchange';
		break;
		case '宠物交易':	
			var file_name = 'pet';
		break;
		case '寻人寻物':	
			var file_name = 'lose';
		break;
		case '房屋租售':	
			var file_name = 'house';
		break;
		case '出兑信息':	
			var file_name = 'junk';
		break;
		case '求职招聘':	
			var file_name = 'job';
		break;
		case '二手车辆':
			var file_name = 'car';
		break;
	}
	$.ajax({
		url:'Service/Template/Service_issue/service_issue_serviceList_condition_'+file_name+'.html?a='+Math.random(),
		success:function(res){
			//alert(33);
			$('#service_issue_serviceList_condition').html(res);
		},
		error:function(){
			$.ajax({
				url:'interface.php',
				data:{
					type:'token',
				},
				success:function(token){
					$.ajax({
						url:'before.php/Before/Index/service_issue_serviceList_condition',
						data:{
							token:token,
							service:sessionStorage.service_info
						},
						success:function(res){
							$('#service_issue_serviceList_condition').html(res);
						}
					})
				}
			})
		}
	});
}




</script>












